<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="com.database.DBManage"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>学生主页</title>
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
  <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
  <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>
<%

String student_id="41901001";


		request.setCharacterEncoding("utf-8");
		String sql="select student_name,student_img from student where student_id="+student_id+" ";
		javax.sql.rowset.WebRowSet rx=DBManage.query(sql);
		
		String sql2="select a.teacher_name,b.teach_course_img,b.teach_class_name from teacher a,teach_class b,teach_class_stu c where a.teacher_id=b.teacher_id and  c.teach_class_id =b.teach_class_id and c.student_id="+student_id+" ";
		javax.sql.rowset.WebRowSet rs=DBManage.query(sql2);
		
		
%>
<%
	while(rx.next()){
		String student_name=rx.getString("student_name");
		String student_img=rx.getString("student_img");
			%>
<nav class="navbar navbar-light bg-light">
  <a class="navbar-brand" href="student.jsp">首页</a>
   <a class="navbar-brand" href="suser.jsp">
    <img src="<%= student_img %>" width="30" height="30" alt=""><%=student_name %>
  </a>
</nav>

<div class="container" style="padding-top:50px;">
  <div class="row">
    <div class="col-3">
		<ul class="list-group" style="text-align:center;">
		  <a href="tuser.jsp" class="list-group-item list-group-item-action">
		  <img src="<%= student_img %>" width="80" height="80" alt=""><br>账号管理</a>
		  <a href="student.jsp" class="list-group-item list-group-item-action">我学的课</a>
		  <a href="search.jsp" class="list-group-item list-group-item-action">加入课程</a>
		</ul>
    </div>
    <%
	}
	rx.close();

	%>
    <div class="col">
		<nav class="navbar navbar-light bg-white">
		  <span class="navbar-text">
		    我学的课
		  </span>
		  <a href="search.jsp" class="btn btn-primary">搜索课程</a>
		</nav>
		<hr>
		<div class="row">
		<%
	while(rs.next()){
		String teacher_name=rs.getString("teacher_name");
		String teach_class_name=rs.getString("teach_class_name");
		String teach_course_img=rs.getString("teach_course_img");
			%>
		  <div class="col-sm-6">
		    <div class="card" style="width: 18rem;">
			  <img class="card-img-top" src="<%=teach_course_img %>" alt="">
			  <div class="card-body">
			    <h5 class="card-title"><%=teach_class_name %></h5>
			    <p class="card-text"><%=teacher_name %></p>
			    <a href="activity_student.jsp" class="btn btn-primary">Go somewhere</a>
		  	  </div>
		    </div>
		  </div>
		  <%
	}
	rs.close();

	%>
		</div>
</div>
    </div>
  </div>
</div>
</body>
</html>